package LanQiao._14JavaB;

import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Scanner;

@RunWith(Enclosed.class)
public class _6蜗牛 {
    //13  18.09  37
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scan.nextInt();
        }
        int[][] fly = new int[n - 1][2];
        for (int i = 0; i < n - 1; i++) {
            fly[i][0] = scan.nextInt();
            fly[i][1] = scan.nextInt();
        }
        double res = arr[0];
        double h = 0, hdiff = -fly[0][0], t = 0;
        for (int i = 0; i < n - 1; i++) {
            t = h / 1.3;
            double o1 = arr[i + 1] - arr[i] + t;
            double o2;
            if (hdiff >= 0){
                o2 = h / 1.3;
            }else {
                o2 = (-hdiff) / 0.7;
            }
            if (i == n - 2){
                o2 += fly[i][0];
            }
            if (o1 < o2){
                res += o1;
                h = 0;
            }else if (o1 > o2){
                res += o2;
                h = fly[i][1];
            }else {
                double s1 =fly[i][1] - fly[i + 1][0];
                double t1;
                if (s1 >= 0){
                    t1 = s1 / 1.3;
                }else {
                    t1 = (-s1) / 0.7;
                }
                double t2 =fly[i + 1][0] / 0.7;
                if (t1 >= t2){
                    res += o2;
                    h = fly[i][1];
                }else {
                    res += o1;
                    h = 0;
                }
            }
            if (i < n - 2){
                hdiff = h - fly[i + 1][0];
            }
        }
        DecimalFormat df = new DecimalFormat("0.00");
        String format = df.format(res);
        System.out.println(format);

        scan.close();
    }

    //他解：DP
    public static class Solution{

        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            //在此输入您的代码...
            int n = sc.nextInt();
            int[] x = new int[n+1];
            int[] a = new int[n+1];
            int[] b = new int[n+1];
            for(int i = 1;i<=n;i++){
                x[i] = sc.nextInt();
            }
            for(int i = 1;i<n;i++){
                a[i] = sc.nextInt();
                b[i+1] = sc.nextInt();
            }

            double[][] dp = new double[n+1][2];
            dp[1][0] = x[1];
            dp[1][1] = x[1] + a[1]/0.7;


            for(int i = 2;i <= n;i++){
                if(a[i]>b[i]){
                    dp[i][1] = Math.min(dp[i-1][0] + x[i]-x[i-1] + a[i]/0.7, dp[i-1][1] + (a[i]-b[i])/0.7);
                }else {
                    dp[i][1] = Math.min(dp[i-1][0] + x[i]-x[i-1] + a[i]/0.7,dp[i-1][1] + (b[i]-a[i]) /1.3);
                }
                dp[i][0] = Math.min(dp[i-1][1] +b[i]/1.3 ,dp[i-1][0]+x[i]-x[i-1]);

            }
            System.out.printf("%.2f",dp[n][0]);
            sc.close();
        }
    }


}
